VPATH = include src lib

libs=sgxiao_util
obj=pascal euler euler2 stirling1 stirling2 compositegenerator primesgenerator

#CPPFLAGS = -I include
CFLAGS = -g -O2 -Iinclude -lsgxiao_util

CC=gcc
LIBS = -Llib



all : ${obj}

compositegenerator: compositegenerator.c
	${CC} ${CFLAGS} ${LIBS} -o $@ $< 

primesgenerator: primesgenerator.c
	${CC} ${CFLAGS} ${LIBS} -o $@ $< 

euler: euler.c
	${CC} ${CFLAGS} ${LIBS} -o $@ $< 

euler2: euler2.c
	${CC} ${CFLAGS} ${LIBS} -o $@ $< 

pascal: pascal.c
	${CC} ${CFLAGS} ${LIBS} -o $@ $< 

stirling1: stirling1.c
	${CC} ${CFLAGS} ${LIBS} -o $@ $< 

stirling2: stirling2.c
	${CC} ${CFLAGS} ${LIBS} -o $@ $< 


main: main.c sgxiao_util.h

#libsgxiaoutil: $(libs)
#	${CC} ${CFLAGS} -fPIC -c $?.c
#	${CC} ${CFLAGS} -shared -o $@.so $<.o
#	mv $@.so lib/

#libs: $(libs)
#	for f in ${libs}
#	do	echo "$f"
#		${CC} ${CFLAGS} --shared -o lib$f.so $f.o
#		mv lib$f.so lib/
#	done

#sgxiao_util: sgxiao_util.c
#	${CC} ${CFLAGS} -fPIC -c $<
#	${CC} ${CFLAGS} --shared $@.o -o $@.so
#	mv $@.so lib/

#test: main
#	${CC} -o main $^ -lsgxiaoutil
#	mv main	bin/

.PHONY : clean
clean :
	rm ${obj}
